<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- 
    JSP Name : nt_300_11.jsp
    Description : 이벤트참여리스트
    author Seung Won
    since 2012. 7. 19.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 7. 19.     Seung Won     최초 생성
--%>
<%@ include file="/WEB-INF/jsp/co/mn/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/co/mn/include/session.jspf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/WEB-INF/jsp/co/mn/include/header.jspf" %>
<script type="text/javaScript" language="javascript">
<!--
$(document).ready(function() {
    /* form validation check */
    onloadCharCheck();
    
    $("#srchButn").bind("click", moveSearch);    // 검색
    $("#delButn").bind("click", delSubmit);    // 삭제
    $("#srchTxt").bind("keydown", eventEnter);    // 엔터키 제어
    
    
});

/*
 * 페이징 
 */
function movePage(num) {
    $("#currentPageNo").val(num);
    $("#mainForm").attr('action','/nt_300_11.do').submit();
}

/*
 * 검색
 */
function moveSearch() {
    
    if (!validateForm($("#mainForm"))) {
        return false;
    }
    
    if (!isSchrChk($("#srchTxt").val())) {
        alert("검색어에는 특수문자를 입력할 수 없습니다.");
        $("#srchTxt").focus();
        return false;
    }

    
    $("#currentPageNo").val("1");
    $("#mainForm").attr('action','/nt_300_11.do').submit();
}

/*
 * 검색 Text EnterKey 처리
 */
function eventEnter() {
    if (event.key == 13) {
        moveSearch();
    }
}

/*
 * 수정, 등록 페이지 이동
 */
function moveDtlPage(idx) {
    $("#parp03Idx").val(idx);
    $("#mainForm").attr('action','/nt_300_13.do').submit();
}

/*
 * 삭제처리
 */
function delSubmit() {
    
    if ($("input[name='arrIdx']").length < 1) return;
    
    var delIdx = "";
    
    for (var i = 0; i < $("input[name='arrIdx']").length; i++){
        if ($("input[name='arrIdx']").eq(i).is(":checked") == true ){
            delIdx = delIdx + $("input[name='arrIdx']").eq(i).val() + ","; 
        } 
    }
    
    if (delIdx == "") {
        alert("삭제할 항목을 선택해 주세요.");
        return;
    }
    
    delIdx = delIdx.substring(0, delIdx.length-1);
    
    if (confirm("삭제하시겠습니까?")) {
        $("#delIdx").val(delIdx);
        $("#currentPageNo").val("1");    
        $("#mainForm").attr('target','comIframe');
        $("#mainForm").attr('action','/nt_300_15.do').submit();
    } else {
        return false;
    }
}

//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HMC GLOBAL CSR</title>
</head>
<body>
    <div id="contents">
        <form id="mainForm" name="mainForm" method="post">
        <input type="hidden" id="currentPageNo" name="currentPageNo" value="${paginationInfo.currentPageNo}" />
        <input type="hidden" id="delIdx" name="delIdx" value="" />
        <input type="hidden" id="parp03Idx" name="parp03Idx" value="" />
        <input type="hidden" id="evntIdx" name="evntIdx" value="" />
        <div class="searchWrap dateWrap">
            <p class="pageResult flow">총&nbsp;<span>${paginationInfo.totalRecordCount}</span>건, 현재페이지 ${paginationInfo.currentPageNo}/${paginationInfo.totalPageCount} </p>
            <div class="search reverse">
                <fieldset>
                    <legend class="invisible">Search</legend>
                    <div class="evtTit">
                        <select id="srchEvntIdx" name="srchEvntIdx">
                        <option value="">전체</option>
                        <c:forEach var="result" items="${selList }" varStatus="status">
                            <option value="${result.evntIdx }" <c:if test="${rqInfo.srchEvntIdx == result.evntIdx }"><c:out value="selected" /></c:if>>${result.titl }</option>
                        </c:forEach>
                        </select>
                    </div>
                    <select id="srchScn" name="srchScn">
                        <option value="" <c:if test="${rqInfo.srchScn == '' }"><c:out value="selected" /></c:if>>전체</option>
                        <option value="title" <c:if test="${rqInfo.srchScn == 'title' }"><c:out value="selected" /></c:if>>제목</option>
                        <option value="contents" <c:if test="${rqInfo.srchScn == 'contents' }"><c:out value="selected" /></c:if>>내용</option>
                    </select><input type="text" class="formSearch" id="srchTxt" name="srchTxt" value="${rqInfo.srchTxt }" title="검색어" minbyte="2" maxlength="10" nullable="true"/><input type="image" id="srchButn" name="srchButn" class="btnSearch" onClick="return;" src="/img/mng/btn/btn_search.gif" alt="검색" title="검색">
                </fieldset>
            </div>
        </div>
        <table border="1" class="resultTable" summary="H-Volunteer Designer 표">
            <colgroup>
                    <col width="5%" />
                    <col width="6%" />
                    <col width="49%" />
                    <col width="10%" />
                    <col width="10%" />
                    <col width="10%" />
                    <col width="10%" />
                    <col width="10%" />
            </colgroup>
            <thead>
                <tr>
                    <th><input type="checkbox" id="fCk" name="fCk" value="all" onclick="setAllChk(this, document.mainForm.arrIdx)" /></th>
                    <th>번호</th>
                    <th>활동명</th>
                    <th>등록일</th>
                    <th>사업장</th>
                    <th>팀명</th>
                    <th>이름</th>
                </tr>
            </thead>
            <tbody>
                <c:choose>
                    <c:when test="${resultList != null && !empty resultList }">
                        <c:forEach var="result" items="${resultList }" varStatus="status">
                <tr>
                    <td><input type="checkbox" id="arrIdx" name="arrIdx" value="${result.parp03Idx }" /></td>
                    <td>${result.blcNo }</td>
                    <td class="dirLeft"><a href="#none" onclick="moveDtlPage('${result.parp03Idx}');return false;">${result.gactNm }</a></td>
                    <td>${result.rgstDt}</td>
                    <td>${result.hkmcBlns }</td>
                    <td>${result.blns }</td>
                    <td>${result.aplcNm }</td>
                </tr>
                        </c:forEach>
                    </c:when>
                    <c:otherwise>
                <tr>
                    <td colspan="7">등록된 내용이 없습니다.</td>
                </tr>
                    </c:otherwise>
                </c:choose>
            </tbody>
        </table>
        </form>
        <div class="btnBoard">
            <span class="flow">
                <input type="submit" id="delButn" name="delButn" title="삭제" value="삭제" />
            </span>
        </div>
        <div class="pageNate">
            <able:pagination paginationInfo="${paginationInfo }" type="image" jsFunction="movePage" />
        </div>
    </div>

    <%
    // 등록 process 를 위한 iFrame Start
    %>
    <iframe name="comIframe" id="comIframe" src="about:blank" height="0" width="0"></iframe>
    <%
    // 등록 process 를 위한 iFrame END
    %>
</body>
</html>